//
//  UserModuleResultParser.m
//  DemoProject
//
//  Created by mouxiaochun on 16/3/17.
//  Copyright © 2016年 mmc. All rights reserved.
//

#import "UserModuleResultParser.h"
#import "UserMethods.h"
#import "ParserObjects.h" 
#import "QHPingJiaObj.h"

@implementation AIRequest (User)

- (void) userModuleHander:(id)responseObject responseData:(NSData *)responseData {
    
     DebugLog(@"responseObject->%@",responseObject);
    

    
    NSDictionary *result = [responseObject copy];
    
    if (!result || result.count == 0) {
        
        [self excuteBlock];
        return;
    }
    NSString *msg = [responseObject objectForKey:@"message"];
    self.result.message = msg;
    self.result.code = [responseObject objectForKey:@"result_code"];
    if ([self.result.code isEqualToString:@"0"]) {
        self.result.success = YES;

    }else{
        self.result.success = NO;

    }
    NSDictionary *dic = [DeviceUtility decryptUseDES:responseObject[@"result_data"] key:YQH_DESEncrypt_Key];

    
    //处理结果就像下面这样 ，依次添加.......  不懂
    //注册
    if ([self.method isEqualToString:_registerOfAction]) {
        NSLog(@"注册result%@",dic);

        
        NSDictionary *registData = [dic getObject:@"QHSignup"];
        
        [self excuteBlockWithObject:registData];
        
        
    }else
    if ([self.method isEqualToString:_getValidCode]) {
        NSLog(@"解析_getValidCode%@",dic);
    
        [self excuteBlockWithObject:dic];

    }else
    
    if ([self.method isEqualToString:_queryUserInfo]) {
        NSLog(@"解析_queryUserInfo%@",dic);
        NSDictionary *object = [dic getObject:@"QHPersonObj"];
        
        [self excuteBlockWithObject:object];
        
    }else
    if ([self.method isEqualToString:_getAllEavList]) {
#pragma mark模型中还有模型

        
        id object = [dic getObject:@"QHPingJiaObj"];
        
        [self excuteBlockWithObject:object];
        
    }else
    if ([self.method isEqualToString:_upLoadDriverInfomation]) {
        NSDictionary *object = [dic getObject:@"QHSignup"];
        [self excuteBlockWithObject:object];
    }else
    
     if ([self.method isEqualToString:_loginOfAction]) {
         NSLog(@"解析_loginOfAction%@",dic);

        NSDictionary *object = [dic getObject:@"QHSignup"];
        [self excuteBlockWithObject:object];
        
     }else  {
         [self excuteBlock];
     }
}

@end
